perm filename NETDPY.FAI[CMS,LCS] blob
sn#193835 filedate 1979-05-20 generic text, type T, neo UTF8
00100 COMMENT ⊗ VALID 00002 PAGES
00200 C REC PAGE DESCRIPTION
00300 C00001 00001
00400 C00002 00002 ENTRY NETDPY
00500 C00008 ENDMK
00600 C⊗;
00100 ENTRY NETDPY
00200 TITLE NETDPY - Subroutine to interface III programs to network
00300
00400 A←1
00500 B←A+1
00600 P←17
00700
00800 IMPBIT←←1000 ;Bit in TTY status for IMP PTY's
00900
01000 NETDPY: PUSH P,A ;Save some AC's
01100 SETO A, ;Get tty number
01200 GETLIN A
01300 TLNN A,IMPBIT ;Is it an IMP tty?
01400 JRST NOTNET ;No, return quickly
01500 MOVEM A,LETTER+4
01600 MOVNI A,(A) ;Get controlling job
01700 TTYJOB A,
01800 MOVEM A,ENVELOPE ;Save number of server
01900 GETNAM A, ;Name of server
02000 AND A,[777700,,0]
02100 CAME A,[SIXBIT/L-/] ;Regular server?
02200 CAMN A,[SIXBIT/D-/]
02300 JRST NOTNET ;Yes, skip it!
02400 PUSH P,B
02500 SKIPN JOBENB↑ ;Any olde interrupts enabled?
02600 JRST [ MOVEI B,JOBCNI↑ ;No, we can use JOBAPR, etc. then
02700 MOVEI A,JOBAPR↑
02800 JRST NOTOLD ]
02900 SKIPN B,JOBINT↑ ;Are there any new interrupts yet?
03000 MOVEI B,MYINTB ;No, use this subroutine's then
03050 MOVEM B,JOBINT ;Now, set it if none already
03100 MOVEI A,2(B) ;Its address of JOBAPR
03200 NOTOLD: MOVEM B,CNIADR ;Save pointer to JOBCNI or equiv.
03300 HRRZ B,(A) ;Get current interrupt vector
03400 CAIN B,INTADR ;Is it ourself?
03500 JRST NOINTS ;Yes, don't stomp on saved interrupt vector!
03600 HRRZM B,APRSAV ;No, save address of old interrupt vector
03700 MOVEI B,INTADR
03800 HRRM B,(A) ;Set interrupt vector (carefully preserving
03900 ;IOT-USER bit in left half)
04000 NOINTS: MOVE B,INTBIT ;This is the bit we expect to get back from
04100 ;server
04200 IMSKCL B ;Mask off interrupt so we don't miss it!
04300 INTORM B, ;Now, enable it
04400 ;(Program better have it in its wakeup mask!)
04500 PJOB B, ;Get job number
04600 MOVEM B,LETTER ;Put it into letter
04700 PUSH P,@-2(P) ;Get display instruction
04800 REXCT: MOVE A,-2(P)
04900 MOVE B,-1(P)
05000 MOVEI A,@(P) ;Get effective address (better not be a stack pointer!!!)
05100 LDB B,[POINT 9,(P),8]
05200 CAIN B,<<XCT>/1B8> ;Is it an execute?
05300 JRST [ POP P,(P) ;Flush old opcode
05400 PUSH P,(A) ;Get next instruction
05500 JRST REXCT ] ;Try again
05600 LDB B,[POINT 4,(P),12] ;Get pog number
05700 POP P,(P) ;Flush stack
05800 MOVEM A,LETTER+1 ;Put display header address into letter
05900 MOVEM B,LETTER+2 ;Put POG number into letter
06000 SETZM IIIDON ;Clear done flag
06100 MALOOP: SKPSEN ENVELOPE ;Try to send letter
06200 SKIPA ;Lose, try again
06300 JRST WAITER ;Win, now wait for reply
06400 MOVEI A,1 ;Go to sleep, and try again
06500 SLEEP A,
06600 JRST MALOOP
06700 WAITER: SETO A, ;Enable interrupt and go into interrupt wait
06800 IMSKCR A ;This gets the mask
06900 SKIPE IIIDON ;Last minute check
07000 JRST [ INTMSK A ;Gee, i'm glad i avoided that timing race!
07100 JRST IIIRET ]
07200 OR A,INTBIT ;Turn on III conversion done interrupt
07300 IMSTW A ;And wait
07400 SKIPN IIIDON ;What woke us?
07500 JRST WAITER ;Something else, try again
07600 IIIRET: POP P,B ;Conversion done, restore AC's and return
07700 AOS (P) ;Skip return
07800 NOTNET: POP P,A
07900 POPJ P,
08000
08100 INTADR: MOVE 7,@CNIADR ;Get interrupt bits
08200 TDNN 7,INTBIT ;Is it for us?
08300 JRST NOTIII ;No, pass on to user
08400 SETOM IIIDON ;Mark as done
08500 INTACM 7, ;Turn off interrupt
08600 CDISMI: DISMIS ;And return from interrupt
08700 NOTIII: SKIPN APRSAV ;Does the user have an interrupt handler?
08800 DISMIS ;No, just ignore other interrupts!
08900 MOVE 7,JOBHRL↑ ;Reset 7 to what the system gave us
09000 JRST @APRSAV ;Start up user's interrupt handler
09100
09200 MYINTB: BLOCK 3 ;Interrupt block (in place of JOBCNI, etc.)
09300 APRSAV: BLOCK 1 ;Address of user's interrupt server
09400 CNIADR: BLOCK 1 ;Address of JOBCNI or equiv.
09500 IIIDON: BLOCK 1 ;Flag set at interrupt level to say server is done
09600
09700 ENVELOPE: 'NETGRF' ;Mailing address of server
09800 LETTER
09900 LETTER: BLOCK 3 ;Letter to server
10000 'UPGIOT' ;Type of message to server
10100 BLOCK 1 ;Number of PTY
10200 INTBIT: 1B17 ;Bit for server to reply with
10300 END